package com.miyake.rest;

import java.io.Serializable;

import org.simpleframework.xml.Element;

public class DataColumn implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Element(required=false)
    private String header = "Column Header";

    @Element(required=false)
    private String data = "";
    
    public DataColumn() {
        
    }
    
    public DataColumn(String header) {
        super();
        this.setHeader(header);
    }
    
    public DataColumn(String header, String[] data) {
        super();
        this.setHeader(header);
        for (int i = 0; i < data.length; i++) {
            this.data += data[i];
            if (i < data.length-1) {
                this.data += ",";
            }
        }
    }
    /**
     * @return the header
     */
    public String getHeader() {
        return header;
    }
    /**
     * @param header the header to set
     */
    public void setHeader(String header) {
        this.header = header;
    }

    public String[] getDataArray() {
        return this.data.split(",");
    }
    
    public void setDataArray(String[] data) {
        for (int i = 0; i < data.length; i++) {
            this.data += data[i];
            if (i < data.length-1) {
                this.data += ",";
            }
        }
    }
    
    public String getData() {
        return this.data;
    }
}
